<?php
/**
 * Created by PhpStorm.
 * User: 王松
 * Time: 2017/6/16 14:18
 */

namespace App\Transformers;

use App\Models\MedicalComplaint;
use League\Fractal\TransformerAbstract;

class ComplaintTransformer extends TransformerAbstract
{
    /**
     * @var array
     */
    protected $field;

    public function __construct()
    {
        $this->field = app('field')->get('weight');
    }

    /**
     * @param \App\Models\MedicalComplaint $complaint
     * @return array
     */
    public function transform(MedicalComplaint $complaint)
    {
        return [
            'id'                 => $complaint->id,
            'record_id'          => $complaint->record_id,
            'symptoms'            => $complaint->symptoms,
            'blood_glucose'      => $complaint->blood_glucose,
            'weightchange'       => $complaint->weightchange,
            'weightchangestatus' => $complaint->weightchangestatus,
            'weightchangekg'     => $complaint->weightchangekg,
            'medication'         => $complaint->medication,
            'cn_medication'      => $complaint->cn_medication,
            'remark'             => $complaint->remark,
        ];
    }
}